#include <stdbool.h>

#ifndef BOARD_H
#define BOARD_H

typedef enum { WHITE, BLACK, NOCOLOR } Color;
typedef enum { QUEEN, ROOK, KNIGHT, BISHOP, KING, PAWN, NOPIECE } Piecetype;
typedef enum { NEWMOVE, CASTLING, PROMOTION, ENPASSANT, CHECK, CHECKMATE, NOTYPE } Movetype;
typedef enum { GAMENOTSTARTED, PLAYER1, PLAYER2, GAMEOVER } State;

//sizeof(Square) = 16
typedef struct
{
  Piecetype type;
  Color color;
  unsigned char row;
  unsigned char col;
  bool occupied;
  bool hasMoved;
  bool pawnTwoSquareMove;
} Square;

//sizeof(Move) = 36
typedef struct
{
  Square src;
  Square dest;
  Movetype type;
}Move;
    


void init_board();
Movetype get_move_type(Square src, Square dest);
void update_board(Square src, Square dest);
bool is_legal_move(Square *src, Square *dest);
bool check_en_passant(int this_move, Color color);
bool is_legal_castling(int this_move, Color color);
void update_local_board(Move *move, Color color);
#endif


